<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
     <meta name='viewport' content='width=device-width, initial-scale=1.0'>
     <title>i++和++i</title>
     <link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/default.min.css'>
     <script src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js'></script>
</head>
<body>
     <pre>
        <code style='max-height: 400px;'>
            // 两者都是数学运算中自身加一 区别::计算的顺序
            let i = 1
            5+(i++) // 7
            console.log(i);

            let j = 1
            5+(++j)
            console.log(j);


            let c = 1
            let a = c++
            console.log('a',a,'c',c); // 1,2
            let k = 1
            let b = ++k
            console.log('b',b,'k',k); // 2,2

            let s = 3
            console.log(5+(++s)+(s++)+3-2+(--s)+(s--)-2);
            console.log(s); // 3
            // 5 + 4 + 4 + 3 - 2 + 4 + 4 - 2 = 20  s:3             
        </code>
     </pre>
     <script> hljs.highlightAll(); </script>
     <script>
        // 两者都是数学运算中自身加一 区别::计算的顺序
        let i = 1
        5+(i++) // 7
        console.log(i);

        let j = 1
        5+(++j)
        console.log(j);


        let c = 1
        let a = c++
        console.log('a',a,'c',c); // 1,2
        let k = 1
        let b = ++k
        console.log('b',b,'k',k); // 2,2

        let s = 3
        console.log(5+(++s)+(s++)+3-2+(--s)+(s--)-2);
        console.log(s); // 3
        // 5 + 4 + 4 + 3 - 2 + 4 + 4 - 2 = 20  s:3
     </script>
</body>
</html>